﻿<div id="status" ng-show="pageLoading"></div>
<div class="all-elements">
    <div id="sidebar" class="page-sidebar">
        <div class="page-sidebar-scroll">
            <div class="nav-item selected-nav-item" data-ng-repeat="r in roleByGroup">
                <a href="#/{{r.RoleValue}}">
                    <div class="icon-nav {{r.RoleValue}}"></div>
                    {{r.RoleName}}
                </a>
            </div>
            <div class="nav-item">
                <a href="#">
                    <div class="icon-nav icon-share" onclick="logout()"></div>
                    THOÁT
                </a>
                <script>
                    function logout() {
                        localStorage.removeItem("idkey");
                        localStorage.removeItem("authen");
                        localStorage.removeItem("menu");
                        $location.path('/login/');
                    }
                </script>
            </div>
        </div>
    </div>



    <div id="content" class="page-content">

        <div class="page-header">
            <p class="logo">
            </p>

            <a href="#" class="deploy-sidebar"></a>
            <div class="user">
                <div class="name">{{userName}}</div>
				<br/>
                <div class="notifi">
                    <span class="noti-chart" ng-show="countNewMessage>0"><a href="#/newMessage">{{countNewMessage}}</a></span>
                    <span class="noti-friend" ng-show="countAddFriend>0"><a href="#/newFriend">{{countAddFriend}}</a></span>
                    <span class="noti-fromroom" ng-show="countFromRoom>0"><a href="#/newFromRoom">{{countFromRoom}}</a></span>
                </div>
            </div>
        </div>

        <div class="page-content-wrapper">
            <div class="container no-bottom">
                <div class="heading">
                    <div class="heading-left">
                        <h3>Quản lý tài khoản</h3>
                    </div>

                </div>
            </div>
            <div class="container">
                <div id="role-tab" class="tab"><span ng-click="userPanelClick()">Quản lý</span><span ng-click="createUserPanelClick()">Tạo tài khoản</span></div>
                <div class="decoration"></div>
                <div ng-show="userPanel">
                    <div class="container no-bottom">
                        <div class="adhere-room">
                            <input id="inputSearch" type="number" placeholder="Nhập tên hoặc email" /><input type='submit' ng-click="searchUs()" value='Tìm' />
                        </div>
                        <table cellspacing='0' class="table">
                            <tr>
                                <th colspan="2" class="table-title">danh sách tài khoản</th>
                                <th>
                                    <select name="group" id="groupList">
                                        <option name="all" ng-click="loadUsersByGroup(0)" value="0">Nhóm</option>
                                        <option data-ng-repeat="g in groups" value="{{g.Id}}" ng-click="loadUsersByGroup(g.Id)">{{g.GroupName}}</option>
                                    </select>
                                </th>
                            </tr>

                            <tr data-ng-repeat="l in users" id="tr_user_{{l.Id}}">
                                <td class="table-sub-title"><img src="{{fileSever}}avatar/{{l.Avatar}}" width="30" height="30" /></td>
                                <td><a href="#/userDetail/{{l.Id}}/{{routeId}}">{{l.UserName}}</a></td>
                                <td>
                                    <span class="icon-inline relative icon-ok-4" ng-click="activeUser(l.Id)" id="user_{{l.Id}}"><span class="icon-ok-3 icon-inline" ng-show="l.Block==false"></span></span>
                                    <span ng-click="deleteUser(l.Id)" class="delete-item-word"></span>
                                </td>
                            </tr>

                            <!--<tr class='even'>
                                    <td class="table-sub-title"> TWO</td>
                                    <td>No</td>
                                </tr>-->
                        </table>
                        <div id="paging"></div>
                    </div>
                </div>
                <div ng-show="createUserPanel">
                    <form name="myForm">
                        <div class="page-content-wrapper">

                            <div class="page-content-wrapper">
                                <div id="lesson-content">
                                    <label for="email">Địa chỉ email</label>
                                    <input type="email" id="email" name="email" ng-model="formData.Email" required ng-blur="checkEmailOnblur()" ng-focus="checkEmailFocus()">
                                    <span ng-show="!myForm.email.$error.required && myForm.email.$error.email && myForm.email.$dirty">Vui lòng nhập một địa chỉ email</span>
                                    <span ng-show="!checkEmail">Địa chỉ email đã được sử dụng</span>
                                    <br />
                                    <label for="email">Tên đầy đủ</label>
                                    <input type="text" id="name" name="name" ng-model="formData.FullName" required />
                                    <span ng-show="myForm.name.$error.required && myForm.name.$dirty">Trường bắt buộc</span>
                                    <br />
                                    <label for="username">Tên tài khoản(dùng đăng nhập)</label>
                                    <input type="text" id="username" name="username" ng-model="formData.UserName" ng-minlength="5" ng-maxlength="20" ng-pattern="/^[A-z][A-z0-9]*$/" required ng-blur="checkUserOnblur()" ng-focus="checkUserFocus()" />
                                    <span ng-show="myForm.username.$error.required && myForm.username.$dirty">Trường bắt buộc</span>
                                    <span ng-show="!myForm.username.$error.minLength && !myForm.username.$error.maxLength && myForm.username.$error.pattern && myForm.username.$dirty">Tài khoản bắt đầu bằng chữ, chỉ được phép dùng chữ và số.</span>
                                    <span ng-show="!myForm.username.$error.required && (myForm.username.$error.minlength || myForm.username.$error.maxlength) && myForm.username.$dirty">Tài khoản phải lớn hơn 5 và nhỏ hơn 20 ký tự.</span>
                                    <span ng-show="!checkUser">Tài khoản này đã được sử dụng</span>
                                    <br />


                                    <label for="password">Mật khẩu</label>
                                    <input type="password" id="password" name="password" ng-model="formData.Password" ng-minlength="8" ng-maxlength="20" required />
                                    <span ng-show="myForm.password.$error.required && myForm.password.$dirty">Trường bắt buộc</span>
                                    <span ng-show="!myForm.password.$error.required && (myForm.password.$error.minlength || myForm.password.$error.maxlength) && myForm.password.$dirty">Password phải từ 8 đến 20 ký tự</span>
                                    <br />


                                    <label for="password_c">Nhập lại mật khẩu</label>
                                    <input type="password" id="password_c" name="password_c" required ng-model="formData.PasswordC" valid-password-c />
                                    <span ng-show="myForm.password_c.$error.required && myForm.password_c.$dirty">Trường bắt buộc</span>
                                    <span ng-show="!myForm.password_c.$error.required && myForm.password_c.$error.noMatch && myForm.password.$dirty">Mật khẩu không trùng khớp.</span>
                                    <br />
                                    <label for="password_c">Nhập lại mật khẩu</label>
                                    <select>
                                        <option ng-repeat="g in groups">{{g.GroupName}}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="footer">
                            <div class="footer-shortcuts">
                                <div>
                                    <a ng-click="clearText()">
                                        <span class="button-bottom icon-back-room"></span><span class="button-text">Xóa trắng</span>
                                    </a>
                                </div>
                                
                                <div>
                                    <button type="submit" class="btn" ng-disabled="!myForm.$valid" ng-click="createUser()"><span class="button-bottom icon-next-lesson"></span><span class="button-text">Tạo tài khoản</span></button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="decoration"></div>
            </div>
        </div>
        <!--<div class="footer">
            <div class="footer-shortcuts">
                <a href="room.html">
                    <div><span class="button-bottom icon-back-room"></span><span class="button-text">Quay về</span></div>
                </a>
                <a href="#">
                    <span class="button-bottom icon-only icon-arrow-up"></span>
                </a>
                <a href="#">
                    <div><span class="button-text">Bài tiếp theo</span><span class="button-bottom icon-next-lesson"></span></div>
                </a>
            </div>
        </div>-->
    </div>
</div>
